Skip to content

fix: processor-level config takes precedence over top-level settings#984

Open
lazureykis wants to merge 1 commit into
open-telemetry:mainfrom
lazureykis:fix/976-processor-exporter-config-override
Open

fix: processor-level config takes precedence over top-level settings#984
lazureykis wants to merge 1 commit into
open-telemetry:mainfrom
lazureykis:fix/976-processor-exporter-config-override

Conversation

@lazureykis
Copy link
Copy Markdown

Summary

Fixes #976.

When both traces_exporter (or bsp_* settings) and processor-level config are set, the processor-level config was silently overridden by the top-level value. For example:

application:set_env(opentelemetry, processors, [
    {otel_batch_processor, #{exporter => {my_exporter, #{}}}}
]),
application:set_env(opentelemetry, traces_exporter, {other_exporter, #{}}),

The batch processor would end up using other_exporter instead of my_exporter.

Changes

  • merge_processor_config_/4: Simplified to always respect processor-level config — if a key already exists in processor opts, top-level/env values don't override it.
  • transform(span_processor, batch|simple): Returns empty #{} instead of BATCH_PROCESSOR_DEFAULTS/SIMPLE_PROCESSOR_DEFAULTS. Defaults are already applied via maps:merge in merge_processor_config/4, so pre-populating was redundant and prevented the merge logic from distinguishing user-set values from defaults.
  • Removed the now-unused is_default/3 helper.

New precedence order

processor opts > top-level/env config > BATCH_PROCESSOR_DEFAULTS

Tests

Added processor_exporter_not_overridden (12 assertions) and processor_config_precedence_with_os_env (4 assertions) covering:

Previously, explicitly setting `traces_exporter` or `bsp_*` options at
the top level would silently override the same keys in processor-level
config. This meant a user who configured `exporter` directly in their
processor opts could have it replaced by a top-level `traces_exporter`
value without warning.

The fix ensures processor opts always take precedence: top-level and
environment variable settings only fill in keys that are absent from
the processor config. The `span_processor` shorthand (`batch`/`simple`)
now starts with empty opts instead of pre-populated defaults, since
defaults are already applied via `maps:merge` in `merge_processor_config`.

Closes open-telemetry#976
@lazureykis lazureykis marked this pull request as ready for review May 8, 2026 16:39
@lazureykis lazureykis requested a review from a team as a code owner May 8, 2026 16:39
@yordis yordis requested a review from tsloughter May 8, 2026 16:55
@lazureykis
Copy link
Copy Markdown
Author

@tsloughter

@tsloughter
Copy link
Copy Markdown
Member

Sorry for the delay and thanks for this. I'm trying to be certain about this. Another issue is sadly another way of configuring things needs to get in soon and will complicate this even more. But I'll likely merge this today because off the top of my head it seems right.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 17.59%. Comparing base (a007d18) to head (4337f68).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #984   +/-   ##
=======================================
  Coverage   17.59%   17.59%           
=======================================
  Files          24       24           
  Lines         722      722           
=======================================
  Hits          127      127           
  Misses        595      595           
Flag Coverage Δ
api 17.59% <ø> (ø)
elixir 17.59% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Batch processor app env config: user-provided exporter overridden by BATCH_PROCESSOR_DEFAULTS merge

2 participants